//一些通用的请求封装
import request from "@/utils/http.ts"

//1.登录接口
export const loginAPI = (data: any) => {
    return request({
        url: 'user/login',
        method: 'post',
        params: {
            account: data.account,
            password: data.password,
        }
    })
}

//2.注册接口
export const registerAPI = (data: any) => {
    return request({
        url: 'user/register',
        method: 'post',
        params: {
            account: data.account,
            password: data.password,
            role: data.role,
        }
    })
}

//3.退出登录接口
export const logoutAPI = (account: string) => {
    return request({
        url: 'user/logout',
        method: 'post',
        params: {
            account: account,
        }
    })
}
//4.删除原来头像接口
export const deleteAvatarAPI = (name: string) => {
    return request({
        url: 'image/delete',
        method: 'post',
        params: {
            name: name,
        }
    })
}
//5.重置密码接口
export const resetPasswordAPI = (account: string, password: string, role: string) => {
    return request({
        url: 'user/resetPassword',
        method: 'post',
        params: {
            account: account,
            password: password,
            role: role,
        }
    })
}